import * as sdk from './fetch';

const controllerName = 'forumController';

/**
 *
 * 查询我发布的帖子
 *
 */
async function findMyPublishForum(params): Promise<BaseResponseString> {
  let result = await sdk.rzpost('forum/findMyPublishForum', {
    ...params,
  });
  return result;
}
/**
 *
 * 查询我点赞的帖子
 *
 */
async function findMyThumbForum(params): Promise<BaseResponseString> {
  let result = await sdk.rzpost('forum/findMyThumbForum', {
    ...params,
  });
  return result;
}
/**
 *
 * 查询我评论的帖子
 *
 */
async function findMyCommentForum(params): Promise<BaseResponseString> {
  let result = await sdk.rzpost('forum/findMyCommentForum', {
    ...params,
  });
  return result;
}
/**
 *
 * 查询我收藏的帖子
 *
 */
async function findMyCollectForum(params): Promise<BaseResponseString> {
  let result = await sdk.rzpost('forum/findMyCollectForum', {
    ...params,
  });
  return result;
}
/**
 *
 * 删除帖子
 *
 */
async function deleteForum(params): Promise<BaseResponseString> {
  let result = await sdk.rzpost('forum/delete', {
    ...params,
  });
  return result;
}
/**
 *
 * 删除评论
 *
 */
async function deleteComment(params): Promise<BaseResponseString> {
  let result = await sdk.rzpost('forum/deleteComment', {
    ...params,
  });
  return result;
}
/**
 *
 * 新增帖子
 *
 */
async function addForum(params): Promise<BaseResponseString> {
  let result = await sdk.rzpost('forum/add', {
    ...params,
  });
  return result;
}
/**
 *
 * 查询发现频道tab
 *
 */
async function getForumTitleList(params): Promise<BaseResponseString> {
  let result = await sdk.rzget(`forum/getForumTitleList?deviceNum=${params.deviceNum}`, {});
  return result;
}
/**
 *
 * 查询帖子列表
 *
 */
async function getForumList(params): Promise<BaseResponseString> {
  let result = await sdk.rzpost('forum/findList', {
    ...params,
  });
  return result;
}
/**
 *
 * 搜索帖子列表
 *
 */
async function getFindConditional(params): Promise<BaseResponseString> {
  let result = await sdk.rzpost('forum/findConditional', {
    ...params,
  });
  return result;
}
/**
 *
 * 帖子点赞
 *
 */
async function addThumb(params): Promise<BaseResponseString> {
  let result = await sdk.rzpost('forum/addThumb', {
    ...params,
  });
  return result;
}
/**
 *
 * 帖子取消点赞
 *
 */
async function deleteThumb(params): Promise<BaseResponseString> {
  let result = await sdk.rzpost('forum/deleteThumb', {
    ...params,
  });
  return result;
}
/**
 *
 * 查询帖子详情
 *
 */
async function findDetail(params): Promise<BaseResponseString> {
  let result = await sdk.rzpost('forum/findDetail', {
    ...params,
  });
  return result;
}
/**
 *
 * 查询评论列表
 *
 */
async function findCommentList(params): Promise<BaseResponseString> {
  let result = await sdk.rzpost('forum/findCommentList', {
    ...params,
  });
  return result;
}
/**
 *
 * 新增评论
 *
 */
async function addComment(params): Promise<BaseResponseString> {
  let result = await sdk.rzpost('forum/addComment', {
    ...params,
  });
  return result;
}

export default {
  findMyPublishForum,
  findMyThumbForum,
  findMyCommentForum,
  findMyCollectForum,
  deleteForum,
  deleteComment,
  addForum,
  getForumTitleList,
  getForumList,
  addThumb,
  deleteThumb,
  findDetail,
  findCommentList,
  addComment,
  getFindConditional,
};

/**
 * 正常请求返回
 */
export interface BaseResponseString {
  /**
   * 结果码
   */
  code: string;
  /**
   * 内容
   */
  data?: {
    [k: string]: any;
  };
  /**
   * 错误内容
   */
  errorData?: {
    [k: string]: any;
  };
  /**
   * 状态
   */
  success?: boolean;
  /**
   * 消息内容
   */
  message?: string;
  [k: string]: any;
}
